<?php

use Encore\Admin\Controllers\AuthController;
use Illuminate\Routing\Router;

Admin::routes();

Route::group([
    'prefix'     => config('admin_la.route.prefix'),
    'namespace'  => config('admin_la.route.namespace'),
    'middleware' => config('admin_la.route.middleware'),
    'as'         => config('admin_la.route.prefix') . '.',
], function (Router $router) {

    $router->get('/', 'HomeController@index')->name('home');
    // 用户
    $router->resource('users', 'UsersController');
    // 商品
    $router->resource('products', 'ProductsController');
    // 众筹商品
    $router->resource('crowdfunding_products', 'CrowdfundingProductsController');
//    $router->get('crowdfunding_products', 'CrowdfundingProductsController@index');
//    $router->get('crowdfunding_products/create', 'CrowdfundingProductsController@create');
//    $router->post('crowdfunding_products', 'CrowdfundingProductsController@store');
//    $router->get('crowdfunding_products/{id}/edit', 'CrowdfundingProductsController@edit');
//    $router->put('crowdfunding_products/{id}', 'CrowdfundingProductsController@update');

    // 分类
    $router->resource('categories', 'CategoriesController');
    $router->get('api/categories', 'CategoriesController@apiIndex');
//    $router->get('categories', 'CategoriesController@index');
//    $router->get('categories/create', 'CategoriesController@create');
//    $router->get('categories/{id}/edit', 'CategoriesController@edit');
//    $router->post('categories', 'CategoriesController@store');
//    $router->put('categories/{id}', 'CategoriesController@update');
//    $router->delete('categories/{id}', 'CategoriesController@destroy');
    // 订单
    // $router->resource('orders', 'OrdersController');
    $router->get('orders/{order}', 'OrdersController@show')->name('orders.show');
    $router->post('orders/{order}/ship', 'OrdersController@ship')->name('orders.ship');
    $router->get('orders', 'OrdersController@index')->name('orders.index');
    $router->post('orders/{order}/refund', 'OrdersController@handleRefund')->name('orders.handle_refund');

    // 优惠券
    $router->resource('coupon-codes', 'CouponCodesController');
//    $router->get('coupon_codes', 'CouponCodesController@index');
//    $router->post('coupon_codes', 'CouponCodesController@store');
//    $router->get('coupon_codes/create', 'CouponCodesController@create');
//    $router->get('coupon_codes/{id}/edit', 'CouponCodesController@edit');
//    $router->put('coupon_codes/{id}', 'CouponCodesController@update');
//    $router->delete('coupon_codes/{id}', 'CouponCodesController@destroy');
});
